package com.redepronik.negosys.rrhh.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.validator.constraints.Email;

/**
 * The persistent class for the emailpersona database table.
 * 
 */
@Entity
@Table(schema = "rrhh", name = "emailpersona")
@NamedQuery(name = "Emailpersona.findAll", query = "SELECT e FROM Emailpersona e")
public class Emailpersona implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(allocationSize = 1, name = "EMAILPERSONA_EMAILPERSONAID_GENERATOR", sequenceName = "RRHH.EMAILPERSONA_EMAILPERSONAID_SEQ")
	@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EMAILPERSONA_EMAILPERSONAID_GENERATOR")
	@Column(unique = true, nullable = false)
	private Integer emailpersonaid;

	@Email(message = "INGRESE UN EMAIL VALIDO")
	@Column(nullable = false, length = 100)
	private String email;

	@Column(nullable = false)
	private Integer orden;

	// bi-directional many-to-one association to Persona
	@ManyToOne
	@JoinColumn(name = "personaid", nullable = false)
	private Persona persona;

	public Emailpersona() {
	}

	public String getEmail() {
		return this.email;
	}

	public Integer getEmailpersonaid() {
		return this.emailpersonaid;
	}

	public Integer getOrden() {
		return orden;
	}

	public Persona getPersona() {
		return this.persona;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setEmailpersonaid(Integer emailpersonaid) {
		this.emailpersonaid = emailpersonaid;
	}

	public void setOrden(Integer orden) {
		this.orden = orden;
	}

	public void setPersona(Persona persona) {
		this.persona = persona;
	}

}